<template>
  <img class="c-icon" :src="src" alt="" :style="{width}">
</template>

<script lang="js">
import iconJson from "./icon";
import {pxToVw} from '../../utils/transform';

export default {
  props: {
    icon: {
      type: String,
      default: ""
    },
    size: {
      type: Number,
      default: 16
    }
  },
  data() {
    return {
      src: "",
      width:""
    }
  },
  async created() {
    this.width = pxToVw(this.size)
    this.src = iconJson[this.icon]
  }
}
</script>

<style scoped lang="stylus">

</style>
